package gui;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.text.ParseException;

import javax.swing.*;
import javax.swing.text.MaskFormatter;

public class PanelInserirEnfermeiro extends JPanel{

	private JTextField campoNome;
	private JFormattedTextField campoCpf;
	private JTextField campoCrm;
	private JLabel nome;
	private JLabel cpf;
	private JLabel cre;
	private JButton consultar;
	Font font = new Font("Tahoma", 10, 15);
	
	public PanelInserirEnfermeiro () throws ParseException{
		MaskFormatter mask = new MaskFormatter("###.###.###-##");
		this.consultar = new JButton ("Cadastrar");
		this.campoNome = new JTextField();
		this.campoCpf = new JFormattedTextField (mask);
		this.campoCrm = new JTextField ();
		this.nome = new JLabel("Nome: ");
		this.cpf = new JLabel("CPF: ");
		this.cre = new JLabel ("CRE: ");
		ajustarTamanho();
		ajustarLocalizacao();
		add(consultar);
		add(campoNome);
		add(campoCpf);
		add(campoCrm);
		add(nome);
		add(cpf);
		add(cre);
		setFont();
		setOpaque(false);
		setBorder(BorderFactory.createTitledBorder(BorderFactory.createBevelBorder(1, Color.white,Color.LIGHT_GRAY), "        CADASTRAR ENFERMEIRO        "));
		setLayout(null);
		setSize(600,500);
		setVisible(false);
	}
	
	public void setFont (){
		nome.setFont(font);
		cpf.setFont(font);
		cre.setFont(font);
		consultar.setFont(font);
	}
	
	public void ajustarTamanho (){
		this.consultar.setSize(new Dimension(100,25));
		this.campoNome.setSize(300, 30);
		this.campoCpf.setSize(100, 30);
		this.campoCrm.setSize(100, 30);
		this.nome.setSize(150, 30);
		this.cpf.setSize(100, 30);
		this.cre.setSize(100,30);
	}
	
	public void ajustarLocalizacao(){
		this.consultar.setLocation(150, 200);
		this.campoNome.setLocation(150, 30);
		this.campoCpf.setLocation(150, 70);
		this.campoCrm.setLocation(150, 110);
		this.nome.setLocation(20, 30);
		this.cpf.setLocation(20, 70);
		this.cre.setLocation(20,110);
	}
}